   <#include
"../common/com.html"/> <@layout>
   	
<!-- ace styles -->
<link rel="stylesheet" href="${ctx}/static/assets/css/ace.min.css" />

<link rel="stylesheet" href="${ctx}/static/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="${ctx}/static/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="${ctx}/static/kindeditor/lang/zh_CN.js"></script>
<script charset="utf-8" src="${ctx}/static/kindeditor/plugins/code/prettify.js"></script>

<script type="text/javascript">
    /**
     * 新增
     */
    function saveModel() {
        var id=document.getElementById("id").value;
              if(Validator.Validate(document.getElementById('form1'))){
        } else {
            return;
        }
        
        url = '';
        if(id==""){
            url = '${ctx}/tbMeetArticle/save';
        }     else{
            url = '${ctx}/tbMeetArticle/update';
        }
        $('#form1').form('submit', {
            url : url,
            onSubmit : function() {
                return $(this).form('validate');
            },
            success : function(data) {
                alert(data);
                parent.location.reload();
                //window.location.href=' ${ctx}/tbMeetArticle';
            }
        });

    }
</script>

<div class="page-content">
<div class="row-fluid">
						<div class="span12">
                <form class="form-horizontal"  id="form1" method="post" >
                	<input type="hidden"  name="id" id="id"    >
						<div class="control-group">
									<label class="control-label">会议:</label>
						<div class="controls"> 
						<input id="meetid_val" type="hidden" class="easyui-numberbox"/> 
						
						<select id="meetid" name="meetid" name="type" id="type" panelheight="80" 
							style="width: 205px;" dataType="Require" msg="请选择会议" >
                        </select>
                         							
						</div>
						</div>
								 	
						<div class="control-group">
									<label class="control-label">软件题目:</label>
						<div class="controls"> <input id="title"
								name="title" type="text" dataType="Require" msg="请输入题目"
								  style="min-height: 24px;"  />
							</div>
								 	</div>
								 	
						<div class="control-group">
									<label class="control-label">内容:</label>
						<div class="controls"> 
						<#-- 
						<input id="content" name="content" type="text"  dataType="Require" msg="请输入内容"
								  style="min-height: 24px;"  />
						-->
						<textarea class="span12"  id="content" name="content" style="width:95%;height:180px;visibility:hidden;"></textarea>		  
							</div>
						</div>
								 	
								 	
						<div id="transmitcount_wrap" class="control-group">
									<label class="control-label">转发量:</label>
						<div class="controls"> <span id="transmitcount" ></span>
							</div>
						</div>
						
						<div  id="createtime_wrap" class="control-group">
									<label class="control-label">创建时间:</label>
						<div class="controls"> <span id="createtime" ></span>
							</div>
						</div>
             </form>
        </div>
        	<div class="span12 center">
				<a  class="btn btn-info btn-small" onclick="saveModel()">确定
				<a href="#"  class="btn btn-danger btn-small bigger-110"  onclick="parent.closeDialog();"  >取消 </a>
		</div>
    </div>
</div>

    </body>
   

<script>
    KindEditor.ready(function(K) {
        K.each({
            'plug-align' : {
                name : '对齐方式',
                method : {
                    'justifyleft' : '左对齐',
                    'justifycenter' : '居中对齐',
                    'justifyright' : '右对齐'
                }
            },
            'plug-order' : {
                name : '编号',
                method : {
                    'insertorderedlist' : '数字编号',
                    'insertunorderedlist' : '项目编号'
                }
            },
            'plug-indent' : {
                name : '缩进',
                method : {
                    'indent' : '向右缩进',
                    'outdent' : '向左缩进'
                }
            }
        },function( pluginName, pluginData ){
            var lang = {};
            lang[pluginName] = pluginData.name;
            KindEditor.lang( lang );
            KindEditor.plugin( pluginName, function(K) {
                var self = this;
                self.clickToolbar( pluginName, function() {
                    var menu = self.createMenu({
                        name : pluginName,
                        width : pluginData.width || 100
                    });
                    K.each( pluginData.method, function( i, v ){
                        menu.addItem({
                            title : v,
                            checked : false,
                            iconClass : pluginName+'-'+i,
                            click : function() {
                                self.exec(i).hideMenu();
                            }
                        });
                    })
                });
            });
        });
        editor =  K.create('#content', {
            cssPath : '${ctx}/static/kindeditor/plugins/code/prettify.css',
            uploadJson : '${ctx}/uploadWxfile/upload/',
            fileManagerJson : '${ctx}/uploadWxfile/manageImg',
            allowFileManager : true,
            themeType : 'default',
            filterMode : true,
            items :[
                'source', //'|', 'undo', 'redo', 
                //'|', 'preview', 'print', 'template', 'paste', 'plainpaste', 'wordpaste',
                 '|', 'justifyleft', 'justifycenter', 'justifyright', // 'justifyfull',
                 'insertorderedlist',// 'insertunorderedlist', 'indent', 'outdent',
                //'clearhtml', 'quickformat', 'selectall', '|',
                'formatblock', 'fontname', 'fontsize', '|', //'/',
                'forecolor', 'hilitecolor', 'bold',
                'italic', 'underline', //'strikethrough', 'lineheight', 'removeformat', '|',
                //'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak','anchor',
                 'link', 'unlink', '|', 'image'//, 'multiimage'
            ] ,
            afterBlur:function(){this.sync(); }
        });

    });
</script>

<script>
    /**
    * 修改页面使用
    */
  $(function(){
	  
		  <#list newlist as m>
			 document.getElementById("id").value  
			 =  '${(m.id)!}';
		     document.getElementById("title").value  
		     =  '${(m.title)!}';
		     document.getElementById("content").value  
		     =  '${(m.content)!}';
		     
		     // 记录选择字段
		     $("#meetid_val").val('${(m.meetid)!}');
		     $("#transmitcount").html('${(m.transmitcount)!}');
		     $("#createtime").html('${(m.createtime)!}');
		    
		</#list>
		
		var id=$("#id").val();
		if(id==""){
			$('#transmitcount_wrap').hide();
			$('#createtime_wrap').hide();
		}
		
		// 会议初始化
		var url = "${ctx}/tbMeet/queryAll";
		$.ajax({
		    url:url,
			data : "",
			success : function success(data) {
				$.each(data,function(key, val) {
					if(data[key].id=="0"){
						$("#meetid").append("<option  value=''>请选择会议</option>");
					}else{
						$("#meetid").append("<option  value='"+data[key].id+"'>" + data[key].text + "</option>");
					}
				});
				// 选择
				$("#meetid").val($("#meetid_val").val());
				
			},
			dataType : "json"
		});
	
  });
 
    </script>
 </@layout> 
